<!---导入重复数据弹出对话框-->
<template>
    <div class="duplicateModal">
        <el-dialog v-model="dialogVisible"  title="导入EXCEL重复数据提示"
            width="500"
            :before-close="handleClose"
            >
            <div class="choicedio">
                <!-- <div style="color:red;font-size:16px">提示：存在重复名称的数据</div> -->
                    <div class="mytitle" style="margin-top:8px;font-size: 20px;margin-bottom:12px">
                        <span></span>设备重复名称的数据列表
                    </div>
                <div class="diatable" style="width:100%;height:400px">
                    <el-table :data="repeatData" height="100%"  @selection-change="handleSelectionChange" stripe  style="width: 100%;">
                        <el-table-column type="selection" width="55" />
                        <!-- <el-table-column type="index"  width="50" label="序号" align="center"> </el-table-column> -->
                        <el-table-column prop="device_name"  label="设备名称"> </el-table-column>
                        <el-table-column prop="device_address"  label="设备地址"> </el-table-column>
                    </el-table>
                </div>
            </div>
            <template #footer>
                <div class="dialog-footer">
                    <el-button @click="handleClose()">取消</el-button>
                    <el-button type="primary" @click="handleSumbit()">确定</el-button>
                </div>
            </template>
        </el-dialog>
    </div>
</template>
<script>
export default {
    data() {
        return {
            dialogVisible:false,
            repeatData:[],

            selectedRows:[],  //选择行
        }
    },
    methods:{
        handleSelectionChange(val){
            this.selectedRows = val;
        },
        handleOpen(duplicateData){
            let that = this;
            that.dialogVisible  = true;
            
            that.selectedRows = [];
            that.repeatData   = [];
            that.repeatData   = [...duplicateData];
        },
        handleClose(){
            this.dialogVisible = false;
        },
        handleSumbit(){
            let that = this;
            let selRows = that.selectedRows;
            if(selRows.length == 0){
                that.$message({showClose: true, message: '请选择重复数据', type: 'error'});
                return;
            }
            that.dialogVisible = false;
            that.$emit('backFun', selRows, that.repeatData);
        }
    }
};
</script>